package android.slc.user.repository.local;

import android.content.Context;
import android.content.Intent;
import android.slc.core.ui.fragment.MvvmFragment;
import android.slc.extras.user.repository.local.UserLocalService;
import android.slc.user.ui.LoginActivity;
import android.slc.user.ui.MyFragment;
import android.slc.user.ui.UserInfoActivity;

import com.google.auto.service.AutoService;

import java.util.ServiceLoader;

/**
 * @author slc
 * @date 2021/2/20 15:42
 */
@AutoService(value = UserLocalService.class)
public class UserLocalServiceImpl implements UserLocalService {

    @Override
    public MvvmFragment<?> getMyFragment() {
        ServiceLoader.load(UserLocalService.class).iterator().next();
        return new MyFragment();
    }

    @Override
    public Intent getUserInfoIntent(Context context) {
        return new Intent(context, UserInfoActivity.class);
    }

    @Override
    public Intent getLoginIntent(Context context) {
        return new Intent(context, getLoginClass());
    }

    @Override
    public Class<?> getLoginClass() {
        return LoginActivity.class;
    }
}
